#include <head.h>
typedef struct shm_str{
    int id;
    char name[128];
}SHM;
int main(int argc, char const *argv[])
{
    int shmid;
    SHM *shm=NULL;

    key_t key = ftok("./key", 'A');

    shmid = shmget(key ,4096,IPC_CREAT|0666);
    if(shmid == -1)
    {
        perror("shmget");
        return -1;
    }
    shm = shmat(shmid,NULL,0);
    if(shm == (void*)-1)
    {
        perror("shmat");
        return -1;
    }
    printf("shmid_id = %d,name=%s\n", shm->id,shm->name);

    shmdt(shm);
    return 0;
    
    
}